package com.charity.rest.controller.manage.website;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.charity.website.vo.query.WebUserCommentPageQuery;
import com.charity.website.service.IWebUserCommentService;
import com.charity.website.vo.model.WebUserCommentModel;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;

/**
 * 网站用户评论  前端控制器
 *
 */
@RestController
@RequestMapping("/manage/manageUserComment")
@AllArgsConstructor
public class ManageUserCommentController {
    
    private final IWebUserCommentService webUserCommentService;

    @PostMapping("/getPageList")
    public IPage<WebUserCommentModel> getPageList(@RequestBody WebUserCommentPageQuery query) {
        return webUserCommentService.getPageList(query);
    }

    @GetMapping(value = "/{id}")
    public WebUserCommentModel getWebUserCommentById(@PathVariable("id") Long id) {
        return webUserCommentService.getWebUserCommentById(id);
    }

    @PostMapping("/createWebUserComment")
    public WebUserCommentModel createWebUserComment(@RequestBody WebUserCommentModel model) {
        return webUserCommentService.createWebUserComment(model);
    }

    @DeleteMapping("/{id}")
    public Integer deleteWebUserComment(@PathVariable("id") Long id) {
        return webUserCommentService.deleteWebUserComment(id);
    }
}
